package com.hex.ds.hdtp.core.app.metadata.service;

import com.hex.ds.hdtp.core.app.common.entity.BasicTransferInfo;
import com.hex.ds.hdtp.core.app.common.service.IBasicService;
import com.hex.ds.hdtp.core.app.data.table.dto.response.TableTransferFieldMapResponseDto;
import com.hex.ds.hdtp.core.inf.metadata.entity.TableFieldsEntity;
import com.hex.ds.hdtp.core.inf.metadata.po.SourceInfoPo;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * @Package: com.hex.hdc.web.cluster.services
 * @ClassName IDataSourceInfoService
 * @Description:
 * @Author: LX
 * @Date 2021-06-29 10:40
 * @Version v1.0
 **/
public interface ISourceInfoService extends IBasicService<SourceInfoPo> {

    SourceInfoPo queryBySourceCode(String sourceCode);

    List<SourceInfoPo> findDefaultSource();

    SourceInfoPo checkSourceCode(String sourceCode);

    SourceInfoPo queryByPkId(String pkId);

    void removeByIds(List<String> pkIds);

    void testConnectById(String pkId);

    void testConnect(SourceInfoPo sourceInfoPo);

    List<String> schemas(String pkId);

    List<String> procedures(String pkId, String schemaName);

    List<String> tables(String pkId, String schemaName);

    void refreshImpalaMetadata(String pkId, String tableName);

    /**
     * 连接表获取字段映射
     * @param transferInfo
     * @return
     */
    List<TableTransferFieldMapResponseDto> getFieldMaps(BasicTransferInfo transferInfo);

    List<TableFieldsEntity> tablesStructure(String pkId, String schemaName, String tableName);

    List<TableFieldsEntity> tablesStructureByType(String pkId, String schemaName, String tableName, String fieldType);

    void executeUpdatetSql(String pkId, String updateSql);

    ByteArrayResource exportMetadata(List<String> pkIds);

    Map<String,Object> importMetadata(MultipartFile file);

    void modifyIsDefault(SourceInfoPo sourceInfoPo);
}
